<?php
require(dirname(__FILE__)."/../inc/common.inc.php");
admin(7);
ini_set('max_execution_time','300000');
ini_set('memory_limit','9000M');
//ini_set("display_errors", "On");
//error_reporting(E_ALL);  
?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="js/html5.js"></script>
<script type="text/javascript" src="js/respond.min.js"></script>
<script type="text/javascript" src="js/PIE_IE678.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="css/H-ui.css"/>
<link type="text/css" rel="stylesheet" href="css/H-ui.admin.css"/>
<link type="text/css" rel="stylesheet" href="font/font-awesome.min.css"/>
<!--[if IE 7]>
<link href="font/font-awesome-ie7.min.css" rel="stylesheet" type="text/css" />
<![endif]-->
<title>管理员列表</title>
</head>
<body>
<?php
if ($_POST['cmd']=="upload")
{

	$err_corr = "不支持的格式或文件损坏";
	$excel_file_size;
	$excel_file = $_FILES['excel_file'];
	$pinfo=pathinfo($excel_file["name"]);
	$ftype=$pinfo['extension'];



	if ($uppass!='xly_!23') 
	{ 
		refreshto("$FROMURL",'升级密码错误!',5);
	} 

	
	$uploadservername=CHEN."tmpexcel/".time().".".$ftype;
	if (!is_writeable(CHEN."tmpexcel/")) 
	{ 
		refreshto("$FROMURL",'目录不可写!',5);
	}    
	if (move_uploaded_file($_FILES['excel_file']['tmp_name'], $uploadservername))
	{
	
	}
	else
	{
		refreshto("$FROMURL",'上传失败!',nl2br());
	}
	$excel_file=$uploadservername;

	if( $excel_file == '' ){
		refreshto("$FROMURL",'没有文件!',2);
	}
	$hzhui=substr($excel_file, strrpos($excel_file, '.')+1);
	 if($hzhui!='zip'){
		refreshto("$FROMURL",'文件错误!',2);		 
	 }
	
	
	
	
	 $zip = new ZipArchive; 
	 $res = $zip->open($excel_file); 
	 if ($res === TRUE) { 
		
		$zip->extractTo('../'); 
		 $zip->close(); 
		 unlink($excel_file);
		 logo('系统升级');
		 refreshto('?',"系统升级成功",2);
	 } else { 		
		 refreshto("$FROMURL",'文件错误!'.$res,2);
	 } 
	
	
	
	
	exit;
}
	
	
?>
 

 
<script>
var i=0;
function chckform()
{
	if(i==1){
		alert('上传中');
		return false;	
	}
	 i=1;
	
	
 
		
}
</script>

<nav class="Hui-breadcrumb"> <?=get_category(7)?> <a class="btn btn-success radius r mr-20" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="icon-refresh"></i></a></nav>
<div class="pd-20">
  <div class="Huiform">
    <table class="table table-border table-bordered table-bg">
 <form method="post" name="from1" enctype="multipart/form-data"	 onSubmit="return chckform()">

    <input type="hidden" value="<?=time()?>" name="fn">
    <tr>
      <td height="25" align="right" bgcolor="#FFFFFF" class="bgcolor">当前系统版本：</td>
      <td height="25" bgcolor="#FFFFFF" class="bgcolor"><?php echo read_file('version.txt');?></td>
    </tr>




  <tr>
   	   <td width="8%" height="25" align="right" bgcolor="#FFFFFF" class="bgcolor">升级密码：</td>
      <td width="92%" height="25" bgcolor="#FFFFFF" class="bgcolor"><input type="text" class="input-text"  name="uppass" /> </td>
    </tr>



    <tr>
   	   <td width="8%" height="25" align="right" bgcolor="#FFFFFF" class="bgcolor">升级包：</td>
      <td width="92%" height="25" bgcolor="#FFFFFF" class="bgcolor"><input type="hidden" value="upload" name="cmd" /><input  class="input-text"  type="file" name="excel_file"> </td>
    </tr>
 <tr>
	    <td height="25" colspan="2" align="center" bgcolor="#FFFFFF" class="bgcolor"><input   class="btn btn-success radius" type="submit" name="subit" value="上传升级包"  />
			 <font color="#FF0004">(升级包必须是开发公司传过来的包才行，上传过程中请耐心等待不要重复点)</font>
	 </td>
    </tr>
    </form>
</table>



<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/Validform_v5.3.2_min.js"></script> 
<script type="text/javascript" src="layer/layer.min.js"></script>
<script type="text/javascript" src="js/H-ui.js"></script>
<script type="text/javascript" src="js/H-ui.admin.js"></script>
<script type="text/javascript">
$(".Huiform").Validform(); 
</script>

</body>
</html>








